

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    
    <title>All the Rest &mdash; Fityk 1.1.1 manual</title>
    <link rel="stylesheet" href="_static/fityk.css" type="text/css" />
    <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    '',
        VERSION:     '1.1.1',
        COLLAPSE_INDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  true
      };
    </script>
    <script type="text/javascript" src="_static/jquery.js"></script>
    <script type="text/javascript" src="_static/underscore.js"></script>
    <script type="text/javascript" src="_static/doctools.js"></script>
    <link rel="shortcut icon" href="_static/fityk.ico"/>
    <link rel="top" title="Fityk 1.1.1 manual" href="index.html" />
    <link rel="prev" title="Curve Fitting" href="fit.html" />
 


  </head>
  <body>
<div style="background-color: white; text-align: center; padding: 10px 10px 10px 10px">
 <a href="http://fityk.nieto.pl/"><img src="_static/fityk-banner.png" alt="" /></a>
</div>

      <div class="sphinxsidebar">
        <div class="sphinxsidebarwrapper">
<h3><a href="fityk-manual.html">Table Of Contents</a></h3>
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="intro.html">Introduction</a></li>
<li class="toctree-l1"><a class="reference internal" href="getstarted.html">Getting Started</a></li>
<li class="toctree-l1"><a class="reference internal" href="lang.html">Mini-Language</a></li>
<li class="toctree-l1"><a class="reference internal" href="data.html">Data</a></li>
<li class="toctree-l1"><a class="reference internal" href="model.html">Models</a></li>
<li class="toctree-l1"><a class="reference internal" href="fit.html">Curve Fitting</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="">All the Rest</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#scripts">Scripts</a></li>
<li class="toctree-l2"><a class="reference internal" href="#id1">Settings</a></li>
<li class="toctree-l2"><a class="reference internal" href="#data-view">Data View</a></li>
<li class="toctree-l2"><a class="reference internal" href="#information-display">Information Display</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#id2">info</a></li>
<li class="toctree-l3"><a class="reference internal" href="#print">print</a></li>
<li class="toctree-l3"><a class="reference internal" href="#debug">debug</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="#other-commands">Other Commands</a></li>
<li class="toctree-l2"><a class="reference internal" href="#starting-fityk-and-cfityk">Starting fityk and cfityk</a></li>
</ul>
</li>
</ul>

  <h3>This Page</h3>
  <ul class="this-page-menu">
    <li><a href="_sources/ref.txt"
           rel="nofollow">Show Source</a></li>
  </ul>
<div id="searchbox" style="display: none">
  <h3>Quick search</h3>
    <form class="search" action="search.html" method="get">
      <input type="text" name="q" size="18" />
      <input type="submit" value="Go" />
      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>
    <p class="searchtip" style="font-size: 90%">
    Enter search terms or a module, class or function name.
    </p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
        </div>
      </div>

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body">
            
  <div class="section" id="all-the-rest">
<span id="ref"></span><h1>All the Rest</h1>
<div class="section" id="scripts">
<span id="settings"></span><h2>Scripts</h2>
<p>Scripts can be executed using the command:</p>
<div class="highlight-fityk"><div class="highlight"><pre>exec filename
</pre></div>
</div>
<p>The file can be either a fityk script (usually with extension <tt class="docutils literal"><span class="pre">fit</span></tt>),
or a Lua script (extension <tt class="docutils literal"><span class="pre">lua</span></tt>).</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">Fityk can save its state to a script (<tt class="docutils literal"><span class="pre">info</span> <span class="pre">state</span> <span class="pre">&gt;</span> <span class="pre">file.fit</span></tt>).
It can also save all commands executed (directly or via GUI) in the session
to a script (<tt class="docutils literal"><span class="pre">info</span> <span class="pre">history</span> <span class="pre">&gt;</span> <span class="pre">file.fit</span></tt>).</p>
</div>
<p>Since a Fityk script with all the data inside can be a large file,
the files may be stored compressed and it is possible to directly read
gzip-compressed fityk script (<tt class="docutils literal"><span class="pre">.fit.gz</span></tt>).</p>
<p>Embedded Lua interpreter can execute any program in Lua 5.1.
Let us create a file named <tt class="docutils literal"><span class="pre">today.lua</span></tt> with one line in it:</p>
<div class="highlight-lua"><div class="highlight"><pre><span class="nb">print</span><span class="p">(</span><span class="nb">os.date</span><span class="p">(</span><span class="s2">&quot;</span><span class="s">Today is %A.&quot;</span><span class="p">))</span>
</pre></div>
</div>
<p>We can execute this script in <tt class="docutils literal"><span class="pre">cfityk</span></tt>:</p>
<div class="highlight-fityk"><div class="highlight"><pre><span class="gp">=-&gt; </span>exec today.lua
Today is Thursday.
=-&gt;
</pre></div>
</div>
<p>The Lua <tt class="docutils literal"><span class="pre">print</span></tt> function writes a string to the standard output,
so we will not see the output in the GUI.
But the Lua interpreter in Fityk has defined global object <tt class="docutils literal"><span class="pre">F</span></tt> which
enables interaction with the program. We can modify our one-line script
to display text in the output window:</p>
<div class="highlight-lua"><div class="highlight"><pre><span class="n">F</span><span class="p">:</span><span class="n">out</span><span class="p">(</span><span class="nb">os.date</span><span class="p">(</span><span class="s2">&quot;</span><span class="s">Today is %A.&quot;</span><span class="p">))</span>
</pre></div>
</div>
<p><tt class="docutils literal"><span class="pre">F</span></tt> is an instance of <a class="reference external" href="https://github.com/wojdyr/fityk/blob/master/src/fityk.h#L80">class Fityk</a> in Lua wrapper.
For now, the only documentation is in the <a class="reference external" href="https://github.com/wojdyr/fityk/blob/master/src/fityk.h">fityk.h</a> header.</p>
<p>Here is an example of Lua-Fityk interactions:</p>
<div class="highlight-lua"><div class="highlight"><pre><span class="c1">-- write data from files file01.dat, file02.dat, ... file13.dat</span>
<span class="k">for</span> <span class="n">i</span><span class="o">=</span><span class="mi">1</span><span class="p">,</span><span class="mi">13</span> <span class="k">do</span>
    <span class="n">filename</span> <span class="o">=</span> <span class="nb">string.format</span><span class="p">(</span><span class="s2">&quot;</span><span class="s">file%02d.dat&quot;</span><span class="p">,</span> <span class="n">i</span><span class="p">)</span>
    <span class="n">F</span><span class="p">:</span><span class="n">execute</span><span class="p">(</span><span class="s2">&quot;</span><span class="s">@+ &lt; &#39;&quot;</span> <span class="p">..</span> <span class="n">filename</span> <span class="p">..</span> <span class="s2">&quot;</span><span class="s">:0:1::&#39;&quot;</span><span class="p">)</span>
<span class="k">end</span>

<span class="c1">-- print some statistics about loaded data</span>
<span class="n">n</span> <span class="o">=</span> <span class="n">F</span><span class="p">:</span><span class="n">get_dataset_count</span><span class="p">()</span>
<span class="n">F</span><span class="p">:</span><span class="n">out</span><span class="p">(</span><span class="n">n</span> <span class="p">..</span> <span class="s2">&quot;</span><span class="s"> datasets loaded.&quot;</span><span class="p">)</span>

<span class="n">total_max_y</span> <span class="o">=</span> <span class="mi">0</span>
<span class="k">for</span> <span class="n">i</span><span class="o">=</span><span class="mi">0</span><span class="p">,</span><span class="n">n</span><span class="o">-</span><span class="mi">1</span> <span class="k">do</span>
    <span class="n">max_y</span> <span class="o">=</span> <span class="n">F</span><span class="p">:</span><span class="n">calculate_expr</span><span class="p">(</span><span class="s2">&quot;</span><span class="s">max(y)&quot;</span><span class="p">,</span> <span class="n">i</span><span class="p">)</span>
    <span class="k">if</span> <span class="n">max_y</span> <span class="o">&gt;</span> <span class="n">total_max_y</span> <span class="k">then</span>
    <span class="n">total_max_y</span> <span class="o">=</span> <span class="n">max_y</span>
    <span class="k">end</span>
<span class="k">end</span>
<span class="n">F</span><span class="p">:</span><span class="n">out</span><span class="p">(</span><span class="s2">&quot;</span><span class="s">The largest y: &quot;</span> <span class="p">..</span> <span class="n">total_max_y</span><span class="p">)</span>
</pre></div>
</div>
<p>If a fityk command executed from Lua script fails, the whole script is
stopped, unless you catch the error:</p>
<div class="highlight-lua"><div class="highlight"><pre><span class="c1">-- wrap F:execute() in pcall to handle possible errors</span>
<span class="n">status</span><span class="p">,</span> <span class="n">err</span> <span class="o">=</span> <span class="nb">pcall</span><span class="p">(</span><span class="n">function</span><span class="p">()</span> <span class="n">F</span><span class="p">:</span><span class="n">execute</span><span class="p">(</span><span class="s2">&quot;</span><span class="s">fit&quot;</span><span class="p">)</span> <span class="k">end</span><span class="p">)</span>
<span class="k">if</span> <span class="n">status</span> <span class="o">==</span> <span class="kc">false</span> <span class="k">then</span>
    <span class="n">F</span><span class="p">:</span><span class="n">out</span><span class="p">(</span><span class="s2">&quot;</span><span class="s">Error: &quot;</span> <span class="p">..</span> <span class="n">err</span><span class="p">)</span>
<span class="k">end</span>
</pre></div>
</div>
<p>The Lua interpreter was added in ver. 1.0.3. If you have any questions
about it, feel free to ask.
You may also see the <a class="reference external" href="https://github.com/wojdyr/fityk/blob/master/samples/hello.lua">hello.lua</a> sample distributed with
the program.</p>
<p>If you do not like Lua, Fityk has also Python and Perl bindings,
and bindings to a few other languages (including Java and Ruby)
can be easily generated. Scripts in these languages can use <em>libfityk</em>
(fityk engine), but cannot interact with the running GUI program.</p>
<p>It is also possible to automate Fityk by preparing a stand-alone program
that writes a valid fityk script to the standard output. To read and execute
the output of such program use command:</p>
<div class="highlight-fityk"><div class="highlight"><pre>exec ! program [args...]
</pre></div>
</div>
</div>
<div class="section" id="id1">
<h2>Settings</h2>
<p>The syntax is simple:</p>
<ul class="simple">
<li><tt class="docutils literal"><span class="pre">set</span> <span class="pre">option</span> <span class="pre">=</span> <span class="pre">value</span></tt> changes the <em>option</em>,</li>
<li><tt class="docutils literal"><span class="pre">info</span> <span class="pre">set</span> <span class="pre">option</span></tt> shows the current value,</li>
<li><tt class="docutils literal"><span class="pre">info</span> <span class="pre">set</span></tt> lists all available options.</li>
</ul>
<div class="admonition-in-the-gui admonition ">
<p class="first admonition-title">In the GUI</p>
<p>the options can be set in a dialog (<em class="menuselection">Session ‣ Settings</em>).</p>
<p class="last">The GUI configuration (colors, fonts, etc.) is changed in a different
way (<em class="menuselection">GUI ‣ ...</em>) and is not covered here.</p>
</div>
<p>It is possible to change the value of the option temporarily:</p>
<div class="highlight-fityk"><div class="highlight"><pre>with option1=value1 [,option2=value2]  command args...
</pre></div>
</div>
<p>For example:</p>
<div class="highlight-fityk"><div class="highlight"><pre>info set fitting_method  <span class="c"># show the current fitting method</span>
set fitting_method = nelder_mead_simplex <span class="c"># change the method</span>
<span class="c"># change the method only for this one fit command</span>
with fitting_method = levenberg_marquardt fit 10
<span class="c"># and now the default method is back Nelder-Mead</span>

<span class="c"># multiple comma-separated options can be given</span>
with fitting_method=levenberg_marquardt, verbosity=quiet fit 10
</pre></div>
</div>
<p>The list of available options:</p>
<dl class="docutils">
<dt>autoplot</dt>
<dd>See <a class="reference internal" href="#autoplot"><em>autoplot</em></a>.</dd>
<dt>cwd</dt>
<dd>Current working directory or empty string if it was not set explicitely.
Affects relative paths.</dd>
<dt>default_sigma</dt>
<dd>Default <em>y</em> standard deviation. See <a class="reference internal" href="data.html#weights"><em>Standard Deviation (or Weight)</em></a>.
Possible values: <tt class="docutils literal"><span class="pre">sqrt</span></tt> max(<em>y</em><sup>1/2</sup>, 1) and <tt class="docutils literal"><span class="pre">one</span></tt> (1).</dd>
<dt>domain_percent</dt>
<dd>See <a class="reference internal" href="model.html#domain"><em>the section about variables</em></a>.</dd>
</dl>
<dl class="docutils" id="epsilon">
<dt>epsilon</dt>
<dd>The <em>ε</em> value used to test floating-point numbers <em>a</em> and <em>b</em> for equality
(it is well known that due to rounding errors the equality test for two
numbers should have some tolerance, and the tolerance should be tailored
to the application): |<em>a−b</em>| &lt; <em>ε</em>. Default value: 10<sup>-12</sup>.
You may need to decrease it when working with very small numbers.</dd>
<dt>fit_replot</dt>
<dd>Refresh the plot when fitting (0/1).</dd>
<dt>fitting_method</dt>
<dd>See <a class="reference internal" href="fit.html#fitting-cmd"><em>Fitting Related Commands</em></a>.</dd>
<dt>function_cutoff</dt>
<dd>See <a class="reference internal" href="model.html#function-cutoff"><em>description in the chapter about model</em></a>.</dd>
<dt>height_correction</dt>
<dd>See <a class="reference internal" href="model.html#guess"><em>Guessing Initial Parameters</em></a>.</dd>
<dt>lm_*</dt>
<dd>Setting to tune the <a class="reference internal" href="fit.html#levmar"><em>Levenberg-Marquardt</em></a> fitting method.</dd>
<dt>log_full</dt>
<dd>Log output together with input (0/1).</dd>
<dt>logfile</dt>
<dd>String. File where the commands are logged. Empty &#8211; no logging.</dd>
<dt>max_fitting_time</dt>
<dd>Stop fitting when this number of seconds of processor time is exceeded.
See <a class="reference internal" href="fit.html#fitting-cmd"><em>Fitting Related Commands</em></a>.</dd>
<dt>max_wssr_evaluations</dt>
<dd>See <a class="reference internal" href="fit.html#fitting-cmd"><em>Fitting Related Commands</em></a>.</dd>
<dt>nm_*</dt>
<dd>Setting to tune the <a class="reference internal" href="fit.html#nelder"><em>Nelder-Mead downhill simplex</em></a>
fitting method.</dd>
</dl>
<dl class="docutils" id="numeric-format">
<dt>numeric_format</dt>
<dd>Format of numbers printed by the <tt class="docutils literal"><span class="pre">info</span></tt> command. It takes as a value
a format string, the same as <tt class="docutils literal"><span class="pre">sprintf()</span></tt> in the C language.
For example <tt class="docutils literal"><span class="pre">set</span> <span class="pre">numeric_format='%.3f'</span></tt> changes the precision
of numbers to 3 digits after the decimal point. Default value: <tt class="docutils literal"><span class="pre">%g</span></tt>.</dd>
<dt>on_error</dt>
<dd>Action performed on error. If the option is set to <tt class="docutils literal"><span class="pre">stop</span></tt>
(default) and the error happens in script, the script is stopped.
Other possible values are <tt class="docutils literal"><span class="pre">nothing</span></tt> (do nothing) and <tt class="docutils literal"><span class="pre">exit</span></tt>
(finish program &#8211; ensures that no error can be overlooked).</dd>
<dt>pseudo_random_seed</dt>
<dd>Some fitting methods and functions, such as
<tt class="docutils literal"><span class="pre">randnormal</span></tt> in data expressions use a pseudo-random
number generator.  In some situations one may want to have repeatable
and predictable results of the fitting, e.g.  to make a presentation.
Seed for a new sequence of pseudo-random numbers can be set using the
option <em class="xref std std-option">pseudo_random_seed</em>.  If it
is set to 0, the seed is based on the current time and a sequence of
pseudo-random numbers is different each time.</dd>
<dt>refresh_period</dt>
<dd>During time-consuming computations (like fitting) user interface can
remain not changed for this time (in seconds).
This option was introduced, because on one hand frequent refreshing of
the program&#8217;s window notably slows down fitting, and on the other hand
irresponsive program is a frustrating experience.</dd>
<dt>verbosity</dt>
<dd>Possible values: -1 (silent), 0 (normal), 1 (verbose), 2 (very verbose).</dd>
<dt>width_correction</dt>
<dd>See <a class="reference internal" href="model.html#guess"><em>Guessing Initial Parameters</em></a>.</dd>
</dl>
</div>
<div class="section" id="data-view">
<h2>Data View</h2>
<p>The command <tt class="docutils literal"><span class="pre">plot</span></tt> controls the region of the graph that is displayed:</p>
<div class="highlight-fityk"><div class="highlight"><pre>plot [[xrange] yrange] [@n, ...]
</pre></div>
</div>
<p><em>xrange</em> and <em>yrange</em> has syntax <tt class="docutils literal"><span class="pre">[min:max]</span></tt>. If the boundaries
are skipped, they are automatically determined using the given datasets.</p>
<div class="admonition-in-the-gui admonition ">
<p class="first admonition-title">In the GUI</p>
<p class="last">there is hardly ever a need to use this command directly.</p>
</div>
<p>The CLI version on Unix systems visualizes the data using the <tt class="docutils literal"><span class="pre">gnuplot</span></tt>
program, which has similar syntax for the plot range.</p>
<p>Examples:</p>
<div class="highlight-fityk"><div class="highlight"><pre>plot [20.4:50] [10:20] <span class="c"># show x from 20.4 to 50 and y from 10 to 20</span>
plot [20.4:] <span class="c"># x from 20.4 to the end,</span>
             <span class="c"># y range will be adjusted to encompass all data</span>
plot         <span class="c"># all data will be shown</span>
</pre></div>
</div>
<p id="autoplot">The values of the options <em class="xref std std-option">autoplot</em> and <em class="xref std std-option">fit_replot</em>
change the automatic plotting behaviour. By default, the plot is
refreshed automatically after changing the data or the model (<tt class="docutils literal"><span class="pre">autoplot=1</span></tt>).
It is also possible to replot the model when fitting, to show the progress
(see the options <em class="xref std std-option">fit_replot</em> and <em class="xref std std-option">refresh_period</em>).</p>
</div>
<div class="section" id="information-display">
<span id="info"></span><h2>Information Display</h2>
<p>First, there is an option <em class="xref std std-option">verbosity</em>
which sets the amount of messages displayed when executing commands.</p>
<p>There are three commands that print explicitely requested information:</p>
<ul class="simple">
<li><tt class="docutils literal"><span class="pre">info</span></tt> &#8211; used to show preformatted information</li>
<li><tt class="docutils literal"><span class="pre">print</span></tt> &#8211; mainly used to output numbers (expression values)</li>
<li><tt class="docutils literal"><span class="pre">debug</span></tt> &#8211; used for testing the program itself</li>
</ul>
<p>The output of <tt class="docutils literal"><span class="pre">info</span></tt> and <tt class="docutils literal"><span class="pre">print</span></tt> can be redirected to a file:</p>
<div class="highlight-fityk"><div class="highlight"><pre>info args &gt; filename    <span class="c"># truncate the file</span>
info args &gt;&gt; filename   <span class="c"># append to the file</span>
info args &gt; <span class="s1">&#39;filename&#39;</span>  <span class="c"># the filename can (and sometimes must) be in quotes</span>
</pre></div>
</div>
<p>The redirection can create a file, so there is also a command to delete it:</p>
<div class="highlight-fityk"><div class="highlight"><pre>delete file filename
</pre></div>
</div>
<div class="section" id="id2">
<h3>info</h3>
<p>The following <tt class="docutils literal"><span class="pre">info</span></tt> arguments are recognized:</p>
<ul class="simple">
<li><em>TypeName</em> &#8211; definition</li>
<li><em>$variable_name</em> &#8211; formula and value</li>
<li><em>%function_name</em> &#8211; formula</li>
<li><tt class="docutils literal"><span class="pre">F</span></tt> &#8211; the list of functions in <em>F</em></li>
<li><tt class="docutils literal"><span class="pre">Z</span></tt> &#8211; the list of functions in <em>Z</em></li>
<li><tt class="docutils literal"><span class="pre">compiler</span></tt> &#8211; options used when compiling the program</li>
<li><tt class="docutils literal"><span class="pre">confidence</span> <span class="pre">level</span> <span class="pre">&#64;n</span></tt> &#8211; confidence limits for given confidence level</li>
<li><tt class="docutils literal"><span class="pre">cov</span> <span class="pre">&#64;n</span></tt> &#8211; covariance matrix</li>
<li><tt class="docutils literal"><span class="pre">data</span></tt> &#8211; number of points, data filename and title</li>
<li><tt class="docutils literal"><span class="pre">dataset_count</span></tt> &#8211; number of datasets</li>
<li><tt class="docutils literal"><span class="pre">errors</span> <span class="pre">&#64;n</span></tt> &#8211; estimated uncertainties of parameters</li>
<li><tt class="docutils literal"><span class="pre">filename</span></tt> &#8211; dataset filename</li>
<li><tt class="docutils literal"><span class="pre">fit</span></tt> &#8211; goodness of fit</li>
<li><tt class="docutils literal"><span class="pre">fit_history</span></tt> &#8211; info about recorded parameter sets</li>
<li><tt class="docutils literal"><span class="pre">formula</span></tt> &#8211; full formula of the model</li>
<li><tt class="docutils literal"><span class="pre">functions</span></tt> &#8211; the list of %functions</li>
<li><tt class="docutils literal"><span class="pre">gnuplot_formula</span></tt> &#8211; full formula of the model, gnuplot style</li>
<li><tt class="docutils literal"><span class="pre">guess</span></tt> &#8211; peak-detection and linear regression info</li>
<li><tt class="docutils literal"><span class="pre">guess</span> <span class="pre">[from:to]</span></tt> &#8211; the same, but in the given range</li>
<li><tt class="docutils literal"><span class="pre">history</span></tt> &#8211; the list of all the command issued in this session</li>
<li><tt class="docutils literal"><span class="pre">history</span> <span class="pre">[m:n]</span></tt> &#8211; selected commands from the history</li>
<li><tt class="docutils literal"><span class="pre">history_summary</span></tt> &#8211; the summary of command history</li>
<li><tt class="docutils literal"><span class="pre">models</span></tt> &#8211; script that re-constructs all variables, functions and models</li>
<li><tt class="docutils literal"><span class="pre">peaks</span></tt> &#8211; formatted list of parameters of functions in <em>F</em>.</li>
<li><tt class="docutils literal"><span class="pre">peaks_err</span></tt> &#8211; the same as peaks + uncertainties</li>
<li><tt class="docutils literal"><span class="pre">prop</span></tt> <em>%function_name</em> &#8211; parameters of the function</li>
<li><tt class="docutils literal"><span class="pre">refs</span></tt> <em>$variable_name</em> &#8211; references to the variable</li>
<li><tt class="docutils literal"><span class="pre">set</span></tt> &#8211; the list of settings</li>
<li><tt class="docutils literal"><span class="pre">set</span></tt> <em>option</em> &#8211; the current value of the option</li>
<li><tt class="docutils literal"><span class="pre">simplified_formula</span></tt> &#8211; simplified formula</li>
<li><tt class="docutils literal"><span class="pre">simplified_gnuplot_formula</span></tt> &#8211; simplified formula, gnuplot style</li>
<li><tt class="docutils literal"><span class="pre">state</span></tt> &#8211; generates a script that can reproduce the current state
of the program. The scripts embeds all datasets.</li>
<li><tt class="docutils literal"><span class="pre">title</span></tt> &#8211; dataset title</li>
<li><tt class="docutils literal"><span class="pre">types</span></tt> &#8211; the list of function types</li>
<li><tt class="docutils literal"><span class="pre">variables</span></tt> &#8211; the list of variables</li>
<li><tt class="docutils literal"><span class="pre">version</span></tt> &#8211; version number</li>
<li><tt class="docutils literal"><span class="pre">view</span></tt> &#8211; boundaries of the visualized rectangle</li>
</ul>
<p>Both <tt class="docutils literal"><span class="pre">info</span> <span class="pre">state</span></tt> and <tt class="docutils literal"><span class="pre">info</span> <span class="pre">history</span></tt> can be used to restore the current
session.</p>
<div class="admonition-in-the-gui admonition ">
<p class="first admonition-title">In the GUI</p>
<p class="last"><em class="menuselection">Session ‣ Save State</em> and
<em class="menuselection">Session ‣ Save History</em>.</p>
</div>
</div>
<div class="section" id="print">
<h3>print</h3>
<p>The print command is followed by a comma-separated list of expressions
and/or strings:</p>
<div class="highlight-fityk"><div class="highlight"><pre><span class="gp">=-&gt; </span>p pi, pi^2, pi^3
3.14159 9.8696 31.0063
<span class="gp">=-&gt; </span>with numeric_format=<span class="s1">&#39;%.15f&#39;</span> print pi
3.141592653589793
<span class="gp">=-&gt; </span>p <span class="s1">&#39;2+3 =&#39;</span>, 2+3
2+3 = 5
</pre></div>
</div>
<p>The other valid arguments are <tt class="docutils literal"><span class="pre">filename</span></tt> and <tt class="docutils literal"><span class="pre">title</span></tt>.
They are useful for listing the same values for multiple datasets, e.g.:</p>
<div class="highlight-fityk"><div class="highlight"><pre><span class="gp">=-&gt; </span>@*: print filename, F[0].area, F[0].area.error
</pre></div>
</div>
<p><tt class="docutils literal"><span class="pre">print</span></tt> can also print a list where each line corresponds to one data point,
as described in the section <a class="reference internal" href="data.html#dexport"><em>Exporting Data</em></a>.</p>
<p>As an exception, <tt class="docutils literal"><span class="pre">print</span> <span class="pre">expression</span> <span class="pre">&gt;</span> <span class="pre">filename</span></tt> does not work
if the filename is not enclosed in single quotes. That is because the parser
interprets <tt class="docutils literal"><span class="pre">&gt;</span></tt> as a part of the expression.
Just use quotes (<tt class="docutils literal"><span class="pre">print</span> <span class="pre">2+3</span> <span class="pre">&gt;</span> <span class="pre">'tmp.dat'</span></tt>).</p>
</div>
<div class="section" id="debug">
<h3>debug</h3>
<p>Only a few <tt class="docutils literal"><span class="pre">debug</span></tt> sub-commands are documented here:</p>
<ul>
<li><p class="first"><tt class="docutils literal"><span class="pre">der</span></tt> <em>mathematic-function</em> &#8211; shows derivatives:</p>
<div class="highlight-fityk"><div class="highlight"><pre><span class="gp">=-&gt; </span>debug der sin(a) + 3*exp(b/a)
f(a, b) = sin(a)+3*exp(b/a)
df / d a = cos(a)-3*exp(b/a)*b/a^2
df / d b = 3*exp(b/a)/a
</pre></div>
</div>
</li>
<li><p class="first"><tt class="docutils literal"><span class="pre">df</span></tt> <em>x</em> &#8211; compares the symbolic and numerical derivatives of <em>F</em> in <em>x</em>.</p>
</li>
<li><p class="first"><tt class="docutils literal"><span class="pre">lex</span></tt> <em>command</em> &#8211; the list of tokens from the Fityk lexer</p>
</li>
<li><p class="first"><tt class="docutils literal"><span class="pre">parse</span></tt> <em>command</em> &#8211; show the command as stored after parsing</p>
</li>
<li><p class="first"><tt class="docutils literal"><span class="pre">expr</span></tt> <em>expression</em> &#8211; VM code from the expression</p>
</li>
<li><p class="first"><tt class="docutils literal"><span class="pre">rd</span></tt> &#8211; derivatives for all variables</p>
</li>
<li><p class="first"><tt class="docutils literal"><span class="pre">%function</span></tt> &#8211; bytecode, if available</p>
</li>
<li><p class="first"><tt class="docutils literal"><span class="pre">$variable</span></tt> &#8211; derivatives</p>
</li>
</ul>
</div>
</div>
<div class="section" id="other-commands">
<h2>Other Commands</h2>
<ul class="simple">
<li><tt class="docutils literal"><span class="pre">reset</span></tt> &#8211; reset the session</li>
<li><tt class="docutils literal"><span class="pre">sleep</span></tt> <em>sec</em> &#8211; makes the program wait <em>sec</em> seconds.</li>
<li><tt class="docutils literal"><span class="pre">quit</span></tt> &#8211; works as expected; if it is found in a script it quits
the program, not only the script.</li>
<li><tt class="docutils literal"><span class="pre">!</span></tt> &#8211; commands that start with <tt class="docutils literal"><span class="pre">!</span></tt> are passed (without the <tt class="docutils literal"><span class="pre">!</span></tt>)
to the <tt class="docutils literal"><span class="pre">system()</span></tt> call (i.e. to the operating system).</li>
</ul>
</div>
<div class="section" id="starting-fityk-and-cfityk">
<span id="invoking"></span><h2>Starting fityk and cfityk</h2>
<p>On startup, the program runs a script from the
<tt class="file docutils literal"><span class="pre">$HOME/.fityk/init</span></tt> file (on MS Windows XP:
<tt class="file docutils literal"><span class="pre">C:\Documents</span> <span class="pre">and</span> <span class="pre">Settings\USERNAME\.fityk\init</span></tt>).
Following this, the program executes command passed with the <tt class="docutils literal"><span class="pre">--cmd</span></tt>
option, if given, and processes command line arguments:</p>
<ul class="simple">
<li>if the argument starts with <tt class="docutils literal"><span class="pre">=-&gt;</span></tt>, the string following <tt class="docutils literal"><span class="pre">=-&gt;</span></tt>
is regarded as a command and executed
(otherwise, it is regarded as a filename),</li>
<li>if the filename has extension &#8221;.fit&#8221; or the file begins with a &#8220;# Fityk&#8221;
string, it is assumed to be a script and is executed,</li>
<li>otherwise, it is assumed to be a data file;
columns and data blocks can be specified in the normal way,
see <a class="reference internal" href="data.html#dataload"><em>Loading Data</em></a>.</li>
</ul>
<p>There are also other parameters to the CLI and GUI versions of the program.
Option &#8220;-h&#8221; (&#8220;/h&#8221; on MS Windows) gives the full listing:</p>
<div class="highlight-none"><div class="highlight"><pre>wojdyr@ubu:~/fityk/src$ ./fityk -h
Usage: fityk \[-h] \[-V] \[-c &lt;str&gt;] \[-I] \[-r] \[script or data file...]
-h, --help            show this help message
-V, --version         output version information and exit
-c, --cmd=&lt;str&gt;       script passed in as string
-g, --config=&lt;str&gt;    choose GUI configuration
-I, --no-init         don&#39;t process $HOME/.fityk/init file
-r, --reorder         reorder data (50.xy before 100.xy)


wojdyr@ubu:~/foo$ cfityk -h
Usage: cfityk \[-h] \[-V] \[-c &lt;str&gt;] \[script or data file...]
-h, --help            show this help message
-V, --version         output version information and exit
-c, --cmd=&lt;str&gt;       script passed in as string
-I, --no-init         don&#39;t process $HOME/.fityk/init file
-q, --quit            don&#39;t enter interactive shell
</pre></div>
</div>
<p>The example of non-interactive using CLI version on Linux:</p>
<div class="highlight-none"><div class="highlight"><pre>wojdyr@ubu:~/foo$ ls *.rdf
dat_a.rdf  dat_r.rdf  out.rdf
wojdyr@ubu:~/foo$ cfityk -q -I &quot;=-&gt; set verbosity=-1, autoplot=0&quot; \
&gt; *.rdf &quot;=-&gt; @*: print min(x if y &gt; 0)&quot;
in @0 dat_a: 1.8875
in @1 dat_r: 1.5105
in @2 out: 1.8305
</pre></div>
</div>
</div>
</div>


          </div>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="fit.html" title="Curve Fitting"
             accesskey="P">previous</a></li>
  <li><a href="http://fityk.nieto.pl/">Home</a>&nbsp;&nbsp;&nbsp;</li>
  <li><a href="https://github.com/wojdyr/fityk/wiki">Wiki</a>&nbsp;&nbsp;&nbsp;</li>
  
        <li><a href="fityk-manual.html">Manual</a> </li>
 
      </ul>
    </div>
    <div class="footer">
      Last updated on 2011-09-28.
      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.7.
    </div>
  </body>
</html>